package com.softmaker.controller;

import com.softmaker.entity.Idioms;
import com.softmaker.entity.UserInfo;
import com.softmaker.service.IdiomsService;
import com.softmaker.service.UserInfoService;
import com.softmaker.utils.ResultVOUtil;
import com.softmaker.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.xml.crypto.Data;

@RestController
@RequestMapping("/idioms")
public class IdiomsController {
    @Autowired
    private IdiomsService idiomsService;
    @PostMapping("/addIdioms")
    public Result<String> addIdioms(@RequestBody Idioms idioms){
        idiomsService.addIdioms(idioms);
        return ResultVOUtil.success("成功");
    }
    @GetMapping("/getIdioms")
    public Result<Idioms> getIdioms(@RequestParam("data") String data){
        Idioms idioms1 = idiomsService.findIdiomsByData(data);
        System.out.println(data);
        System.out.println(idioms1);
        return ResultVOUtil.success(idioms1);
    }

}
